<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>父元素和子元素已知宽度</title>
</head>
<style>
    *{
        margin:0 auto;
    }
    html,body{
      width:100%;
      height:100%;  
    }
    .box{            
        width:500px;
        height:500px;            
        background-color: red;            
        display: table-cell;            
        vertical-align: middle;                    
    }        
    .box .a{            
        width: 100px;            
        height: 100px;            
        background-color: blue;        
    } 

</style>
<body>
    <div class="box">         
        <div class="a">love</div>    
    </div>
</body>
</html>